LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   massive rename of songs; normalize song filename convert foriegn to english character (https://www.linuxquestions.org/questions/linux-general-1/massive-rename-of-songs%3B-normalize-song-filename-convert-foriegn-to-english-character-929320/)

sys64738 02-16-2012 12:48 PM

OK IC
thats not a problem of insufficient rights but about missing directories in the receiving directory. Sorry for missing out that problem.
If you have enough disk space, you could use cp instead of mv, which is even a more safe way.
Code:

find /home/ununun/music/ -type f -print | grep [^[:print:]] | while read file; do N=$(echo $file | tr -cd '[:print:]'); cp -rv "$file" "$N" ; done
"cp -rv" copies the files and directories (-r) and the -v makes it be verbose.

You said
Quote:

yes manish == ununun ; just avoiding extra information.
If there is a problem too much information can not be a problem. The lack of information can be a problem. Don't take offense ;)

Is "/home/manish == /home/ununun"?
I just want to understand your configuration right.

ununun 02-16-2012 01:14 PM

Quote:

Originally Posted by sys64738 (Post 4604318)
OK IC
thats not a problem of insufficient rights but about missing directories in the receiving directory. Sorry for missing out that problem.
If you have enough disk space, you could use cp instead of mv, which is even a more safe way.
Code:

find /home/ununun/music/ -type f -print | grep [^[:print:]] | while read file; do N=$(echo $file | tr -cd '[:print:]'); cp -rv "$file" "$N" ; done
"cp -rv" copies the files and directories (-r) and the -v makes it be verbose.

the problem is not safety. the problem bash cannot find the path. for example
Code:

# find /home/manish/music/ -print | grep '[^[:print:]]'
/home/manish/music/2/6/1/M2D.Jessie J �������� Who You Are.2011.By.AL-SHIMAA
/home/manish/music/2/6/QUANTIC  _'_'AN ANNOUNCEMENT TO ANSWER_'/QUANTIC  ''AN ANNOUNCEMENT TO ANSWER''  (UK,2006)@/���� Copyright
/home/manish/music/2/6/QUANTIC  _'_'AN ANNOUNCEMENT TO ANSWER_'/QUANTIC  ''AN ANNOUNCEMENT TO ANSWER''  (UK,2006)@/���� Copyright.txt
/home/manish/music/4/2/2/jigga jazzist/Jaga Jazzist - J�vla Jazzist Grete Stitz
/home/manish/music/3/2/bjork/Bj���rk - (1997) - Telegram
/home/manish/music/3/2/bjork/Bj���rk - (2004) - Vespertine Live
/home/manish/music/3/2/bjork/Bj���rk - (2005) - Drawing Restraint #9
/home/manish/music/3/2/bjork/Bj���rk - (1997) - Homogenic
/home/manish/music/3/2/bjork/Bj���rk - (2004) - Medulla
/home/manish/music/3/2/bjork/Bj���rk - (2004) - Homogenic Live
/home/manish/music/3/2/bjork/Bj���rk - (2009) - Voltaic
/home/manish/music/3/2/bjork/Bj���rk - (2001) - Vespertine
/home/manish/music/3/2/bjork/Bj���rk - (2000) - Selmasongs Dancer In The Dark
/home/manish/music/3/2/bjork/Bj���rk - (2007) - Volta
/home/manish/music/3/2/bjork/Bj���rk - (1990) - Gling-Glo
/home/manish/music/3/2/bjork/Bj���rk - (2004) - Post Live
/home/manish/music/3/2/bjork/Bj���rk - (1993) - Debut
/home/manish/music/3/2/bjork/Bj���rk - (1995) - Post
/home/manish/music/3/4/sigur ros/(2007) Hjl��malind [Single]
/home/manish/music/3/4/sigur ros/(2008) Inni�� Me��r Syngur Vitleysingur [Single]
/home/manish/music/3/4/cocteau twins/1993 - Four Calendar Caf�����
/home/manish/music/3/5 - mos,etc/1/musicpack/VA - DJ Top 100 Vol.3 (TME  Open Gate Records [������ CD03598]) WEB - 2011
/home/manish/music/3/5 - mos,etc/1/musicpack/VA - DJ Top 100 Vol.3 (TME  Open Gate Records [������ CD03598]) WEB - 2011/CD3
/home/manish/music/3/5 - mos,etc/1/musicpack/VA - DJ Top 100 Vol.3 (TME  Open Gate Records [������ CD03598]) WEB - 2011/CD2
/home/manish/music/3/5 - mos,etc/1/musicpack/VA - DJ Top 100 Vol.3 (TME  Open Gate Records [������ CD03598]) WEB - 2011/CD1
/home/manish/music/1/11/Karpe_Diem-Aldri_solgt_en_l��������gn-2010
/home/manish/music/1/28/8/delerium/Deler  Chimera2k3/Delerium - Chimera (Limited) [2003]/������������������������������������������������������������������������������������������ �����������������������������������������������������������������������������.txt
/home/manish/music/1/28/9/09_-_OST.Le_Fabuleux_Destin_D_Am__lie_Poulain__2001/OST.����������������������������������������������� (Le Fabuleux Destin D'Am��������lie Poulain, 2001)
/home/manish/music/1/28/9/09_-_OST.Le_Fabuleux_Destin_D_Am__lie_Poulain__2001/OST.����������������������������������������������� (Le Fabuleux Destin D'Am��������lie Poulain, 2001)/covers
/home/manish/music/1/32/3/R yksopp  Junior (2009)/R����yksopp - Junior (2009)
/home/manish/music/1/32/3/Röyksopp  The Understanding (2005)/R����yksopp - The Understanding (2005)
#  find /home/manish/music/ -type f -print | grep [^[:print:]] | while read file; do N=$(echo $file | tr -cd '[:print:]'); cp -iv  "$file" "$N" ; done
`/home/manish/music/2/6/QUANTIC  _\'_\'AN ANNOUNCEMENT TO ANSWER_\'/QUANTIC  \'\'AN ANNOUNCEMENT TO ANSWER\'\'  (UK,2006)@/\326\262\302\251 Copyright.txt' -> `/home/manish/music/2/6/QUANTIC _\'_\'AN ANNOUNCEMENT TO ANSWER_\'/QUANTIC \'\'AN ANNOUNCEMENT TO ANSWER\'\' (UK,2006)@/ Copyright.txt'
cp: cannot create regular file `/home/manish/music/2/6/QUANTIC _\'_\'AN ANNOUNCEMENT TO ANSWER_\'/QUANTIC \'\'AN ANNOUNCEMENT TO ANSWER\'\' (UK,2006)@/ Copyright.txt': No such file or directory
`/home/manish/music/1/28/8/delerium/Deler  Chimera2k3/Delerium - Chimera (Limited) [2003]/\327\263\342\202\254\326\262\302\242\327\263\342\202\254\326\262\302\265\327\263\342\202\254\326\263\302\267\327\263\357\277\275\327\237\302\277\302\275\327\263\357\277\275\327\222\342\202\254\357\277\275\327\263\342\202\254\326\262\302\276\327\263\342\202\254\326\262\302\262\327\263\357\277\275\327\222\342\202\254\302\271\327\263\342\202\254\326\262\302\271 \327\263\342\202\254\326\262\302\264\327\263\342\202\254\326\262\302\276\327\263\342\202\254\326\263\302\267\327\263\357\277\275\326\266\342\200\231\327\263\342\202\254\326\262\302\274\327\263\342\202\254\326\262\302\265\327\263\342\202\254\326\262\302\275\327\263\357\277\275\327\222\342\202\254\357\277\275.txt' -> `/home/manish/music/1/28/8/delerium/Deler Chimera2k3/Delerium - Chimera (Limited) [2003]/ .txt'
cp: cannot create regular file `/home/manish/music/1/28/8/delerium/Deler Chimera2k3/Delerium - Chimera (Limited) [2003]/ .txt': No such file or directory

the problem is cp (or mv in previous case) is converting these forign characters in escape sequece.

thanks

sys64738 02-16-2012 04:30 PM

you have used
Quote:

....cp -iv "$file" "$N"....
try
Code:

....cp -irv  "$file" "$N"....
I think the problem is not
Quote:

converting these forign characters in escape sequece
but creating the destination directories.
To check that see if you got any directories of the source "/home/manish/music/..." in "/home/ununun/music/..."
or whatever your destination is.
What is your current directory when starting the command?


All times are GMT -5. The time now is 11:04 PM.