Files with spaces....


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Files with spaces....
# 1  
Old 03-25-2008
Files with spaces....

Ok, I have this script that will look for files with the .pl4 extension and rename them with the modification date... But it breaks when the file has a space in it... (files are on windows machine) ive been trying to fix it but no luck.... Any help is greatly appriciated..

#! /bin/sh
for file in $(find -name '*.pl4'); do dd=`stat -c %y "$file"`; dd=${dd:0:10}; echo $(basename $file); cp "$file" "../pathloss/$dd-$(basename "$file")"; done
# 2  
Old 03-25-2008
Well i got a somewhat fix if anyone comes along a similar problem

IFS=$'\n'

in the begining of file to change the delimiters
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Process files in loop which have spaces in name

I have a folder with files and I have to process them in a loop. However the filenames have space characters, so the list get split. $ touch "File Number_1" $ touch "File Number_2" $ ls "/tmp/File Number"_* /tmp/File Number_1 /tmp/File Number_2 I tried following (sorry for using the... (3 Replies)
Discussion started by: Wernfried
3 Replies

2. AIX

Find and rm files with spaces in the name

I'm sure this has been answered before, but my searches have not turned up the right solution. :confused: I need to remove files in a directory, without descending into subdirectories, older than n days. Some of the filenames contain spaces or other special characters: E10403 (2) E20402 (2)... (15 Replies)
Discussion started by: Papa Lee
15 Replies

3. UNIX for Dummies Questions & Answers

Deleting the files with spaces

Hi All, The shell script is currently using the below command to find the seven days older files from a directories and delete them. Issue occurs when the file name consists of space in them. eg: abc def 1245.txt I need to delete the files names with space also. Please help. Thanks. Below... (7 Replies)
Discussion started by: abhi_123
7 Replies

4. UNIX for Dummies Questions & Answers

List of files with spaces

Hi, Anyone can help me on how to list the file with spaces? Like I want to "ls" only the 2008 files. 2008 _overview102.jpg 2008 _overview103.jpg 2008 _overview106.jpg 2008 _overview677.jpg 2008 _overview680.jpg 2008 _overview110.jpg 2008 _overview682.jpg 2009 _overview4373.jpg 2009... (1 Reply)
Discussion started by: fspalero
1 Replies

5. Shell Programming and Scripting

Moving files that contain spaces...

I have a script that I've written and it's been running fine until someone dropped a file in the source directory that had spaces in it. The script breaks the file name into separate mv commands. I've tried putting " around the $FILE but that didn't help. Anyone who can help me would be greatly... (8 Replies)
Discussion started by: Sanglant
8 Replies

6. UNIX for Dummies Questions & Answers

How to read files with spaces

Hi I am a newbie to unix. I have a current script that reads a directory for excel files and renames the files. There is a problem now because some of the files have spaces. If I put quotes on the file, it will work but I dont know how to read all the files with quotes. Variables $1 =... (6 Replies)
Discussion started by: Lillyt
6 Replies

7. Shell Programming and Scripting

Dealing with files with spaces in the name

Hello, I'm a computer science major and I'm having problems dealing with file names with spaces in them. Particularly I'm saving a file name in a variable and then using the variable in a compare function i.e. a='te xt.txt' b='file2.txt' cmp $a $b If anyone could help me with this particular... (10 Replies)
Discussion started by: jakethegreycat
10 Replies

8. Shell Programming and Scripting

copying files with spaces in the filename

Hi I am having difficulty copying files from one dir to another due to a space in the names of the file with an extension .rtf There are a group of files and the command am using is cp `ls -rt /wlblive/home/whiops/ops/RTFs/*.rtf|head -20` /wlblive/home/jamshed Since the files are... (3 Replies)
Discussion started by: jamshedj
3 Replies

9. Shell Programming and Scripting

Read files including spaces

I am accessing two files. I am using read command to read from the files. For the first file, I need read the fields delimited by spaces, and for the other file, I need to read the whole line as a single field including the spaces. When I used read command for the second file, the spaces... (4 Replies)
Discussion started by: kumariak
4 Replies

10. UNIX for Dummies Questions & Answers

Accessing files/folders with spaces

Hi there, our unix and windows are related. i.e. if i save a file while being on windows my unix profile would contain the same file, at the same location. so i can access all my files through unix prompt. but if i save a file/folder being on windows account and put spaces between the name of... (3 Replies)
Discussion started by: a25khan
3 Replies
Login or Register to Ask a Question