Maybe try this. To avoid moving files just moved to all/txt
, move
them to a new txt
directory outside of all
, then move txt
under
all
. Here we go:
$ mkdir txt
The next one will only print all move commands. Check that you like
what you see:
$ find all | sed -rn 's#^all/recup_dir.([^/]*)/([^/]*).txt$#mv -n "&" "txt/\1-\2.txt"#p'
mv -n "all/recup_dir.20/2.txt" "txt/20-2.txt"
mv -n "all/recup_dir.20/1.txt" "txt/20-1.txt"
mv -n "all/recup_dir.19/5.txt" "txt/19-5.txt"
mv -n "all/recup_dir.19/4.txt" "txt/19-4.txt"
...
When satisfied, run them by appending | sh
:
$ find all | sed -rn 's#^all/recup_dir.([^/]*)/([^/]*).txt$#mv -n "&" "txt/\1-\2.txt"#p' | sh
then put txt
where it belongs:
$ mv txt all
1.txt
) will overwrite each other. How do you want to resolve this conflict? – stefan Apr 03 '18 at 13:32