Hi, thank you for your answer. That worked perfectly and solved my problem, thanks
That is full command that I used.
Code:
find /testing -mindepth 1 -maxdepth 1 ! -path /testing/1.txt ! -path /testing/tmp -exec mv {} /testing/tmp \
I also tried to play a little bit with this command and I see is it easy to adjust it to different scenarios.
Eg. to skip file: /testing/backup/1.txt
So, I modified command like this:
Code:
find /testing -mindepth 1 -maxdepth 1 ! -path /testing/backup/1.txt ! -path /testing/tmp -exec mv {} /testing/tmp \;
find /testing -mindepth 1 -maxdepth 2 ! -path /testing/backup/1.txt ! -path /testing/tmp -exec mv {} /testing/tmp \;
but it failed...
dir /testing/tmp has not been moved (thats good) but /testing/backup/1.txt has been moved.
Why is that ?.
UPDATE:
and it is odd because by issuing this I have a good output:
Code:
find /testing -mindepth 1 -maxdepth 2 ! -path /testing/backup/1.txt ! -path /testing/tmp
/testing/2.txt
/testing/.hidden_file
/testing/1.txt
/testing/backup
/testing/backup/2.txt
/testing/backup/test_file
/testing/passwd_link
... but it does not work with mv command.
UPDATE #2
I think I know why. Its probably because of this:
Code:
find /testing -mindepth 1 -maxdepth 2 ! -path /testing/backup/1.txt ! -path /testing/tmp
/testing/2.txt
/testing/.hidden_file
/testing/1.txt
/testing/backup
/testing/backup/2.txt
/testing/backup/test_file
/testing/passwd_link
...and if Im right its quite tricky to make it working now