Is there a good way to run cp
on the shell (MinGW, in my case) to copy only non-hidden files (i.e. files whose names do not begin with .
)?
I'd like to exclude my .svn
folders and their contents.
at end of the source path is a specific cp syntax that allowes to copy all files and folders, including hidden ones.
Select the Start button, then select Control Panel > Appearance and Personalization. Select Folder Options, then select the View tab. Under Advanced settings, select Show hidden files, folders, and drives, and then select OK.
Using the rsync Command It accepts two valuable options that allow us to include or exclude files during the copy: –include=PATTERN and –exclude=PATTERN. To skip hidden files and directories, we can pass the “. *” pattern to the –exclude option.
The shell doesn't expand *
to include names starting with a dot, so:
cp * /target/directory
That won't copy the .svn
directory.
If that isn't your issue (e.g. you are trying to do a recursive copy with sub-directories that contain hidden files), please clarify what you are up to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With