I'm not allowed to use rsync on the cluster I'm working on so I need to use things like cp
or tar
or find
etc. I want to copy a large directory including all files and subfolders etc. while ignoring, i.e. not copying any files that for example have the names "file1", "file2" or "file3".
I saw this post on SO which allows me to include only certain files. I want basically that but I want to exclude certain files.
I also tried this solution
but when I tried a command using tar
which was suggested there I get the error tar: This does not look like a tar archive
and tar: Cowardly refusing to create an empty archive
I also tried cp !(filename-to-ignore) new_dir/
from this post but this doesn't copy the subfolders.
I'm a beginner with bash so if you could explain your answer and what the flags etc. do that would really be helpfull, I've been trying forever now, on what I think shouldn't be that hard to do.
rsync
would be easiest, even if it meant installing it as a non-root user in your home directory. Contact the admin(s) of the cluster. They likely have a standard way of performing backups or can suggest a way for you to get data off of the cluster in the way you want it. Many backup tools have exclusion options, like--exclude
inrestic
etc. It is their job to help you, the user of the system.