LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2012, 06:35 AM   #1
dimothy
LQ Newbie
 
Registered: Jun 2010
Posts: 10

Rep: Reputation: 0
difficulties using find -exec while preserving timestamps


I have a number of PDF files on a Windows server that we are OCRing (some of you may notice a general theme to most of my questions here) and I have hit a bit of a brick wall in terms of what I am trying to do. I fear I may have over complicated it in my head somewhat.

All the file names and most of the directories are not exactly linux friendly in that they have spaces in the names. After some troubleshooting I worked out that this was causing the issue with using find at the start of a for loop. I then moved on to using the -exec switch with the find command. Now all my documents are OCRed.

The trouble is I need to preserve the time stamp of the original file before I overwrite it with the OCR program and then apply this timestamp to the new file. I was thinking of doing this in my for loop (using touch to store them as variables and then reapply them) but then I hit the issue with spaces in the filenames.

Is there a way to pass filenames with spaces from the find command to a for loop without it having errors?
 
Old 04-17-2012, 08:13 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
here you can find some tips: http://content.hccfl.edu/pollock/Unix/FindCmd.htm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find and -exec {} gleipnir Linux - Newbie 6 02-23-2010 06:22 PM
Find with -exec argument - not giving proper output..how to find... hinetvenkat Linux - Server 4 01-25-2010 07:19 AM
find -exec syntax: bug in find? mfcarroll Programming 5 06-21-2007 08:13 PM
find -exec help dc144 Linux - Newbie 3 10-12-2006 03:14 AM
find -exec cricbk Linux - Newbie 4 01-05-2004 08:03 PM


All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration