Copying *.htm from DVD to local disk

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
martyix
Posts: 9
Last visit: Sat Sep 20, 2008 6:41 pm

Copying *.htm from DVD to local disk

Post by martyix »

Hello, I would like to copy all .htm files from DVD to my disk but I want to preserve the tree structure. Example:E: (DVD mechanics) contain files:===============index.htmpicturespictures.htmand result should be:D: (local disk)===========D:tempprojectindex.htmD:tempprojectpicturespictures.htmI'm totally newbie to PS so I've come up only with this and I don't know how to finish it:get-Childitem E: -recurse | where{$_.Extension -match "htm"} | foreach { $tmp=$_.name; # copy-item $_ D:tempproject ...}Thank you for help!
User avatar
martyix
Posts: 9
Last visit: Sat Sep 20, 2008 6:41 pm

Copying *.htm from DVD to local disk

Post by martyix »

Hello, I would like to copy all .htm files from DVD to my disk but I want to preserve the tree structure. Example:E: (DVD mechanics) contain files:===============index.htmpicturespictures.htmand result should be:D: (local disk)===========D:tempprojectindex.htmD:tempprojectpicturespictures.htmI'm totally newbie to PS so I've come up only with this and I don't know how to finish it:get-Childitem E: -recurse | where{$_.Extension -match "htm"} | foreach { $tmp=$_.name; # copy-item $_ D:tempproject ...}Thank you for help!
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Copying *.htm from DVD to local disk

Post by jhicks »

You'd think this wouldn't be that difficult to do in PowerShell.

copy -path e: -filter *.htm -dest D:TempProject -recurse -container -passthru

Because you are copying from the root of E: this should be ok. When I try this copying from a sub folder, I end up with the subfolder in the target folder.

Let me know how this works for you.
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Copying *.htm from DVD to local disk

Post by jhicks »

does it work better if you omit the -container parameter? Or are you good?
User avatar
martyix
Posts: 9
Last visit: Sat Sep 20, 2008 6:41 pm

Copying *.htm from DVD to local disk

Post by martyix »

Once again thank you! I would like to warn you that I have PowerShell 2.0 (CTP 2)
User avatar
martyix
Posts: 9
Last visit: Sat Sep 20, 2008 6:41 pm

Copying *.htm from DVD to local disk

Post by martyix »

thank you! It works fine for me! :-) Well I still don't understand what was wrong with: E: .. if it's a bug in CTP or if it has some good reason for the bahaviour..
This topic is 15 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked