Hi,
kann mir mal jemand nen Tip geben?
Wie kann man so was mit bash/shell ohne find machen? Inklusive Leerzeichen-Problemlösung?
Auf richtigem Linuxserver funktioniert das find. Ein Workaround wäre suuuper.
Eigentlich soll er nur rekursiv in allen Verzeichnissen nach *.doc suchen und alles was er findet verschieben.
Grüße
Heinz
Code
[/share/external/DEV3301_1/backup/scripte] # find /share/external/DEV3301_1/backup/scripte/1 -name '*.doc' -exec mv {} /share/external/DEV3301_1/backup/scripte/2/ \;BusyBox v1.01 (2014.09.01-17:39+0000) multi-call binaryUsage: find [PATH...] [EXPRESSION]Search for files in a directory hierarchy. The default PATH isthe current directory; default EXPRESSION is '-print'EXPRESSION may consist of: -follow Dereference symbolic links. -name PATTERN File name (leading directories removed) matches PATTERN. -print Print (default and assumed). -type X Filetype matches X (where X is one of: f,d,l,b,c,...) -perm PERMS Permissions match any of (+NNN); all of (-NNN); or exactly (NNN) -mtime TIME Modified time is greater than (+N); less than (-N); or exactly (N) days
So geht es bei mir in auf dem QNAP
Bash
#!/bin/bash
echo "DOC"
for file in `find /share/external/DEV3301_1/backup/scripte/1 -type f -name "*.doc*"`
do mv -i "$file" /share/external/DEV3301_1/backup/scripte/2
done
echo "XLS"
for file in `find /share/external/DEV3301_1/backup/scripte/1 -type f -name "*.xls*"`
do mv -i "$file" /share/external/DEV3301_1/backup/scripte/2
done
echo "PDF"
for file in `find /share/external/DEV3301_1/backup/scripte/1 -type f -name "*.pdf"`
do mv -i "$file" /share/external/DEV3301_1/backup/scripte/2
done
Alles anzeigen