![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Patterns in Filenames | msb65 | Shell Programming and Scripting | 6 | 08-01-2008 04:44 PM |
| spaces in filenames, for do | naviztirf | Shell Programming and Scripting | 4 | 10-17-2007 05:08 PM |
| tar contains duplicate filenames | dangral | UNIX for Dummies Questions & Answers | 2 | 03-14-2007 04:18 PM |
| Trouble with Backslashes | wibo1 | Shell Programming and Scripting | 0 | 09-15-2006 04:22 AM |
| How to echo 4 backslashes more easy ? | sun-guy | Shell Programming and Scripting | 4 | 08-08-2006 02:07 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Backslashes in Filenames
Using a small script, I automatically generated some text logs. The files ended being undownloadable, unopenable and undeletable. Upon further investigation, the files ended up looking like this:
log\r log2\r log3\r I've tried a few different things, including double slashing before the r in order to try and get these files to be usable. I've adjusted the script so it no longer does this, but I'd like to be able to access these other logs. Any ideas? |
|
||||
|
Yeah.. I tried that. I get critical error. The filenames don't show with the \r so I am certain that is causing some sort of conflict with the filename. I've tried renaming with wildcards. Frustrated.
Thanks for all the suggestions. I do appreciate it. |
|
||||
|
Try ls -lab to find out exactly what characters are in the filenames and (more importantly) how many characters are there.
Then "ls" each file with question marks for the doubtful characters to make sure you can refer to the file uniquely. Then rename (mv) each file - again using question marks for the doubtful characters. Finally delete the renamed file. |
|
||||
|
Here is a dead-sure way of erasing even the most nastily named file:
get the inode number by using "ls -lai": Code:
bakunin@machine # ls -lai 246400 drwxr-x--- 5 user staff 256 Oct 21 15:08 . 246236 drwxr-x--- 4 user staff 256 Oct 17 14:26 .. 246237 drwxr-x--- 2 user staff 256 Oct 14 15:50 SPECS 249856 drwxr-x--- 2 root admin 256 Oct 21 15:08 aix 246613 -rw-r----- 1 user staff 6499 Oct 20 12:45 some_file_with_a_funny_name Code:
bakunin@machine # find . -inode 246613 -exec rm -f {} \;
But in your case it might be even simpler than that: if the "\r" in the filenames are real character and not the visualization of some nasty control chars (find out by piping "ls -la" to a file and use "set list" in vi to display control codes) then simply escaping the backslash should suffice: "filename\\r" for what is displayed as "filename\r", etc. I hope this helps. bakunin |
![]() |
| Bookmarks |
| Tags |
| backslashes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|