after searching and trying various way I couldn't get it work.
I need to copy lots of files (more than 100 thousand files) to another folder with dot appended to the start of the file name.
Example:
/foo/bar/filename1.txt
to/foo2/bar/.filename1.txt
- and then rename it back to original name
/foo2/bar/filename.txt
Why I need to do this is because I have an application that will keep scanning /foo2/bar
folder and ignore those file with a dot in front of the file name so that it will not process those file that are copying half way. This mainly because the 2 folder can be in 2 different network drive or some mounted devices.
And i cannot simply use mv or cp because I have some folder that has too many files and it will simply throw argument list too long error thus I have been trying to use find command but to no avail.
Trying out with different command:
find /foo/bar/ -type f -exec cp -t /foo2/bar {} +
and
find /foo/bar/ -type f -exec mv {} /foo2/bar/.{} \;
I know the above command won't do what I wanted that is along the line of what i've tired.
Appreciate anyone that can help...
mkdir /foo2; cp -a /foo/bar /foo2
? The commandcp -a
copies all files recursively.