Run a command on all the .pst files of a folder in Cygwin

1

I have several .pst mailbox in a folder. I would like to use readpst to extract them and have the .msg they contain in a folder.

So let's say 1.pst, 2.pst ... 15.pst. (the actual names are actually a bit longer and more complicated)

I will run a command such as readpst -S -o out/ 1.pst

If I were to run this command in one go for all the .pst files in that folder. How should I amend the command for this to happen? Maybe, put the name of the folder in question? Is there a command that encompass all the document in one folder?

I could make a script of the command I would like to execute and run it for each file, but it won't run on all the file in the folder, right?

Thank you

user4926345

Posted 2019-07-29T15:14:21.850

Reputation: 21

Try with for loop: https://ss64.com/bash/for.html

– Biswapriyo – 2019-07-29T15:17:59.207

Thanks, this seems complicated. A friend suggested to put this: readpst -D -S -o msg/ *.pst so all the .pst files in the directory will be taken. Unfortunately it does work with the first one, but not the rest.... :/ – user4926345 – 2019-07-29T16:42:30.750

Using the loop with this: $ for thisfile in *; do readpst -D -S -o out/ "$thisfile"; done It worked wonder. Thank you very much. – user4926345 – 2019-07-30T10:19:42.187

Answers

1

I managed to find an answer to my question.

By using the loop with this:

for thisfile in *; do
    readpst -D -S -o out/ "$thisfile"
done

As suggested by @Biswapriyo using this info: https://ss64.com/bash/for.html

user4926345

Posted 2019-07-29T15:14:21.850

Reputation: 21