Link to home
Start Free TrialLog in
Avatar of Brandon .
Brandon .

asked on

Help with simple script.

For loop syntax is confusing, I tried researching and I still wasn't able to make sense of the syntax. This is a very simple script and it does the following:
1 > Recursively loop through current and subdirectories, finding .jpg files
2 > once found, simply do this command
echo. >> *.jpg

Open in new window

And that's it
Here's what I've tried so far so that I don't look lazy.

@echo off
FOR /D %%a IN (*.jpg) DO (echo. >> *.jpg %%a)

Open in new window


Code works without error but does not achieve what I want. The purpose of the
echo. >> *.jpg

Open in new window

command is to simply send empty data to the jpg files so that the md5 is changed but without causing any problems to the picture itself
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brandon .
Brandon .

ASKER

Doesn't seem to change the md5 though....look:

User generated image
Directory, name of file, etc is all right, don't know why it doesn't work
The command
echo. >> *.jpg

Open in new window

seems to be the problem

Trying
echo. >> test.jpg

Open in new window

works instead..
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Running the script doesn't change the md5, running the command
echo. >> test.jpg

Open in new window

does, what could be wrong?

The wildcard seems to be weird (for a lack of a better word)
Before F12B908EC97DDDACA7ED58A364CFDB55  11.png
After FB0E0949C977F495B70C1C9E8DD0B8D4  11.png
You need to put command in a batch file, not run it directly
The script without the /D in it is the answer, the /D was causing the problem , removed the /D and it's working

Thank you @Shaun Vermaak
The script without the /D in it is the answer, the /D was causing the problem , removed the /D and it's working

Thank you @Shaun Vermaak and @Guy Hengel [angelIII / a3]