Removing unknow chars from file names.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Removing unknow chars from file names.
# 1  
Old 07-06-2012
Removing unknow chars from file names.

I'm trying to move a large folder to an external drive but some files have these weird chars that the external drive won't accept.

Does anyone know any command of any bash script that will look through a given folder and remove any weird chars?
# 2  
Old 07-07-2012
What filesystem is this drive formatted with? What's "weird" is defined by that...
# 3  
Old 07-07-2012
The external drive is in FAT32.

Some of the weird char are things like | and other special chars.

---------- Post updated 07-07-12 at 04:11 PM ---------- Previous update was 07-06-12 at 11:08 PM ----------

Does anyone know a string to find an remove special characters (excluding the period) from all file names in a folder recursively?
# 4  
Old 07-07-2012
If you search the forums for "renaming files recursively", you may find useful information.

Regards,
Alister
# 5  
Old 07-07-2012
Found it thank you for your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Change encoding, no removing special chars. inconv

Hi all, I'm using iconv command to change files encoding to UTF-8 If my input file has chars as those are removed creating the file without those special chars. I tried using iconv -c, but there is still the removal. Is there a way to keep those special chars changing just the... (6 Replies)
Discussion started by: mrreds
6 Replies

2. UNIX for Advanced & Expert Users

Removing special chars from file and maintain field separator

Running SunOs 5.6. Solaris. I've been able to remove all special characters from a fixed length file which appear in the first column but as a result all subsequent columns have shifted to the left by the amount of characters deleted. It is a space separated file. Line 1 in input file is... (6 Replies)
Discussion started by: iffy290
6 Replies

3. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies

4. Shell Programming and Scripting

Removing rows and chars from text file

Dear community, maybe I'm asking the moon :rolleyes:, but I'm scratching my head to find a solution for it. :wall: I have a file called query.out (coming from Oracle query), the file is like this: ADDR TOTAL -------------------- ---------- TGROUPAGGR... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

5. UNIX for Dummies Questions & Answers

Removing path name from list of file names

I have this piece of code printf '%s\n' $pth*.msf | tr ' ' '\n' | sort -t '-' -k7 -k6r \ | awk -F- '{c=($6$7!=p&&FNR!=1)?ORS:"";p=$6$7}{printf("%c%s\n",c,$0)}' When I run it I get /home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.002-8x6drw-csq.msf... (8 Replies)
Discussion started by: kristinu
8 Replies

6. Shell Programming and Scripting

Removing files with same text but different file names

Hi All, I have some 50,000 HTML files in a directory. The problem is; some HTML files are duplicate versions that is wget crawled them two times and gave them file names by appending 1, 2, 3 etc after each crawl. For example, if the file index.html has been crawled several times, it has been... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Red Hat

tar: Removing leading `/' from member names

Hello, when i start to take backup following error generate please share solution for this problem i am very thankful to you. $ tar -czvf orahome.tar.gz /testhome/TEST/PROD/orahome/ tar: Removing leading `/' from member names O.S 4.5 Red Hat Thanks, Umair (1 Reply)
Discussion started by: umair
1 Replies

8. UNIX for Dummies Questions & Answers

Question/review my script: removing bad chars from filenames

The task: remove undesirable characters from filenames. Restrictions: Must use basic RE, base utilities (non-GNU) and /bin/sh (ash). No ksh, zsh, perl, etc. Below is what I've come up with. It seems to work OK but I'm open to shorter, more efficient alternatives. Inside the square... (4 Replies)
Discussion started by: uiop44
4 Replies

9. UNIX for Dummies Questions & Answers

removing first 7 characters of directory names

Hi, I'm relatively new to unix, and would like to change the following files in a particular directory. The files have names like: M10_90_Phcn402_3F.ab1 M10_94_Sput402_3F.ab1 M11_92_Abrg402_3R.ab1 M10_91_Cdel402_3F.ab1 M11_90_Phcn402_3R.ab1 M12_84_Sput402_3R.ab1... (4 Replies)
Discussion started by: euspilapteryx
4 Replies

10. Shell Programming and Scripting

removing non-printable chars from multiple files

How do I remove non-printable characters from all txt files and output the results to one file? I've tried the following: tr -cd '\n' < *.txt > out.txt and it gives ambiguous redirect error. How can I get it to operate on all txt files in the current directory and append the output to... (1 Reply)
Discussion started by: revax
1 Replies
Login or Register to Ask a Question