AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need to read a dir and sub dir for all .jpg

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
scriptmonkey



Joined: 19 May 2006
Posts: 112

PostPosted: Fri Nov 16, 2007 8:06 am    Post subject: Need to read a dir and sub dir for all .jpg Reply with quote

I am trying to find duplicate files in a number of folders. What I need to do choose a directory, then the script goes thru the dir and sub dirs and find all .jpg files. The path, filename, and modification date/time (the date/time the picture was taken) will be exported to a text file.

I know how to read a file for the modification date, but how can I go thru a dir and sub dirs to search for only .jpg files?
_________________
Zak M.
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Fri Nov 16, 2007 9:06 am    Post subject: Reply with quote

if you want find duplicate can sort it by filename and modifications date
Code:
AA=c:\test
F1=savedfilenames.txt
F2=sortedfiles.txt
ifexist,%F1%
  filedelete,%F1%
ifexist,%F2%
  filedelete,%F2%
I=0
  Loop %AA%\*.jpg,,1
     {
      LFP=%A_LoopFileLongPath%
      LFN=%A_LoopFilename%
      LFM=%A_loopfiletimemodified%
      fileappend,%LFN%;%LFM%;%LFP%`r`n,%F1%
      I++
      }

    FileRead,AB,%F1%
    Sort,AB
    FileAppend,%AB%,%F2%
run,%F2%
exitapp
Back to top
View user's profile Send private message
scriptmonkey



Joined: 19 May 2006
Posts: 112

PostPosted: Fri Nov 16, 2007 2:57 pm    Post subject: Reply with quote

Thanks. This should work fine. I can rename the txt file to CSV and pop it into Excel.

Question though, how can I replace the semicolons with commas?

fileappend,%LFN%;%LFM%;%LFP%`r`n,%F1%

CHANGE TO

fileappend,%LFN%,%LFM%,%LFP%`r`n,%F1%

I tried putting them in quotes, but it didn't work.
_________________
Zak M.
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1186
Location: switzerland

PostPosted: Fri Nov 16, 2007 3:07 pm    Post subject: Reply with quote

need escape character also for `% (if you have one procent sign, not in this case )
example `r`n is for carrige return and linefeed
fileappend,what1`,what2`r`n,where


Code:
fileappend,%LFN%`,%LFM%`,%LFP%`r`n,%F1%
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group