Errors in filenames

Soldato
Joined
4 Jan 2004
Posts
20,803
Location
¯\_(ツ)_/¯
I'm running Linux on my NAS, and it seems to have some files in with invalid filenames.

For example I have a file called

01 - Natalia⥸0%99s Song.wav

when it should be

01 - Natalia's Song.wav

And now I cannot access the file.

OSX throws this up:

h1FWc.png


but if I try and CP the file using terminal I get this:

cp: 01 - Natalia⥸0%99s Song.wav: No such file or directory

Even though is shows up using the LS command.

Would a FSCK fix this or is something a little more creative required to fix this?

THanks.
 
Soldato
Joined
10 Oct 2005
Posts
8,705
Location
Nottingham
An fsck is unlikely to help here. The issue is down to the special characters in the filename which are causing the issues. For instance with your cp command it is just looking for a file called 01 as the space,by default, is seen as a separater between the parameters being passed to the command.

You need to either escape the non-standard characters or use wild cards. Assuming that this is the only file in the directory starting with 01 I would try in the first instance running something like

cp 01* 01natalias_song.wav
 
Soldato
Joined
4 Aug 2009
Posts
5,310
Location
London
Or just use "\ " so that it knows that it is a space in the name and not a separator.

e.g.

cp 01\ -\ Natalias_song.wav destination_song.wav
 
Soldato
Joined
10 Oct 2005
Posts
8,705
Location
Nottingham
Which I said was one of the options, you're escaping the non-standard characters, (although your example is incorrect as you would also need to escape the - character as well as the spaces), and the mess in the original file name due to the ' probably makes it easier to use wildcards in this case.
 
Top