Tag Info

New answers tagged

0

I can't say precisely what your problem is, but there are several issues. The main problem I see is with this line: cp "$f" ~/temp/merged/$orig_f Before executing cp, the shell is looking for a variable orig_f (that does not exist). Underscores are valid characters in variable names, i.e. variable_a="value". So if you are trying to prefix or append a ...


0

GNU cp(1) has a backup option: cp --backup SOURCE [SOURCE...] [DESTINATION] This has the following effects which can be controlled with other options as described in the manual page of cp(1): --backup[=CONTROL] make a backup of each existing destination file -b like --backup but does not accept an argument -S, --suffix=SUFFIX ...


1

find /home/ -ipath "*/temp/some.file" -type f -execdir cp {} another.file \; You just have to change exec to execdir from the other answer (sorry I cannot post it as a comment yet). The execdir option states, according to find's man page: -execdir command {} + Like -exec, but the specified command is run from the subdirectory containing ...


0

find /home/ -ipath "*/temp/some.file" -type f -exec cp {} another.file \;


3

file1 -> dir1/sub file2 -> dir2/sub file3 -> dir3/sub file4 -> dir4/sub . . The names of files and directories are with numbers as above? for i in {1..300}; do cp file$i dir$i/sub; done



Top 50 recent answers are included