Created
July 12, 2012 11:58
-
-
Save Kyrremann/3097709 to your computer and use it in GitHub Desktop.
Copy and move files similar to copy/paste in a file manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copyfile | |
copyfile() { | |
local files=""; | |
local path="$PWD"; | |
for var in $@; | |
do | |
files="${files} ${path}/${var}"; | |
done; | |
echo ${files} | xclip; | |
} | |
# pastfile | |
pastefile() { | |
local path="$PWD"; | |
local from=`xclip -o`; | |
if [ -d $file ]; | |
then | |
cp -R $from $path; | |
else | |
cp $from $path; | |
fi; | |
} | |
# movefile | |
movefile() { | |
local path="$PWD"; | |
local from=`xclip -o`; | |
mv $from $path; | |
} | |
# cutfile | |
cutfile() { | |
local files=""; | |
local tmp_files=""; | |
local path="$PWD"; | |
for var in $@; | |
do | |
if [ -d /tmp/$var ]; | |
then | |
rm -R /tmp/$var; | |
fi; | |
files="${files} ${path}/${var}"; | |
tmp_files="${tmp_files} /tmp/${var}"; | |
done; | |
mv ${files} /tmp/; | |
echo ${tmp_files} | xclip; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed both bugs!