hi guys i have a simple question
i have a directory with name of files in /tmp which contain some files
i want to check all files with file command and if they were MP3 or Wave sync them into new place . for example ( /root/mp3 )
i find all files and remove white space and rename them
next i check them with file command and if they were mp3 or wave we should sync or copy them with exact path into new place
eg.
/tmp/files/test1 ------> /root/mp3/test1
/tmp/files/New/test2 ----------> /root/mp3/New/test2
/tmp/files/New/last/Old/test-old ------------> /root/mp3/New/last/Old/test-old
files should copy into same directory in new the place
what can i do ?
i think to
echo $new |sed "s#/tmp/files#/root/mp3"
but it doesnt work
what can i do ??
PHP Code:
#!/bin/bash
old=/tmp/files
new=/root/mp3
find /tmp/files3 -name *.* | while read FILE
do
new=$(echo $FILE | sed 's/ /_/g')
mv "$FILE" $new
file "$new" |egrep -w 'MP3|WAVE'
if [ $? = 0 ]
then
cp .................
fi
done