0

Hi,

I'm pretty new to scripting so need some help...

Basically I have a 1TB drive that hosts hundreds of .mdf files. What I want to do is search this drive for these .mdf files, zip them, and then delete the original .mdf file permanently.

Any advice/help would be greatly appreciated.

Thanks

Steven

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by cfajohnson
0
dir=/path/to/1TB/drive
IFS=$(printf "\n") zip mdf $(find "$dir" -name '*.mdf')
find "$dir" -name '*.mdf' -exec rm {} +
0


Windows powershell is not a Unix shell.

"Shell Scripting forum is the place for Q&A-style discussions related to *nix shell scripting languages"

0
dir=/path/to/1TB/drive
IFS=$(printf "\n") zip mdf $(find "$dir" -name '*.mdf')
find "$dir" -name '*.mdf' -exec rm {} +

Why IFS=$(printf "\n") instead of just IFS=$'\n' ? To avoid bash-only feature?

0

Why IFS=$(printf "\n") instead of just IFS=$'\n' ? To avoid bash-only feature?


Exactly; the $'\n' syntax is not portable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.