Hi,
I run a batch script to modify images in folders and subfolders in windows. It works great, but it runs imagemagick for every single image in the folders. Is there a way to limit the files that are modified to a time period eg. a week from date modified?
Thanks
Running batch file only on images recently modified
-
- Posts: 4
- Joined: 2018-09-24T10:23:26-07:00
- Authentication code: 1152
Re: Running batch file only on images recently modified
I would suggest you create a script to loop through all the files you want to modify and only send the one to IM that meet the criterial.
Just remember if you go by time span you will have to make sure the ones you ran in the previous run are older; otherwise they will be changed again.
Just remember if you go by time span you will have to make sure the ones you ran in the previous run are older; otherwise they will be changed again.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Running batch file only on images recently modified
You would have to use your OS to test the modified date in your loop and do an if test on the date range. If it passes then process. If it does not pass, then skip the file via you looping mechanism (such as continue in unix)
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Please, always provide your IM version and platform when asking questions, since syntax may differ.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Running batch file only on images recently modified
As the others have mentioned, you'll probably do best to use some system utility to check or sort your files according to the modified times/dates. If you're using Windows Vista or newer, try this at the command line to learn about the "forfiles" command...harryhermit wrote: ↑2018-10-13T23:24:42-07:00I run a batch script to modify images in folders and subfolders in windows. It works great, but it runs imagemagick for every single image in the folders. Is there a way to limit the files that are modified to a time period eg. a week from date modified?
Code: Select all
forfiles /?
-
- Posts: 4
- Joined: 2018-09-24T10:23:26-07:00
- Authentication code: 1152
Re: Running batch file only on images recently modified
The forfiles command looks promising, but I'm having issues with it bringing up the correct products with my criteria. What's the correct command to bring products that have been modified within the past 7 days? I tried this command, but it seems to bring products that are older than 7 days ago:
forfiles /D -7
Using
forfiles /D +7 doesn't bring up any results
I can get the last 7 days by setting the command to bring files newer than a date 7 days from the current date, but I'd have to manually set the date each time. That wouldn't be the automatic solution I am seeking
forfiles /D +10/08/18
Any help would be appreciated
forfiles /D -7
Using
forfiles /D +7 doesn't bring up any results
I can get the last 7 days by setting the command to bring files newer than a date 7 days from the current date, but I'd have to manually set the date each time. That wouldn't be the automatic solution I am seeking
forfiles /D +10/08/18
Any help would be appreciated