Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a PS script

Status
Not open for further replies.

Chris Simpson68

IS-IT--Management
Apr 20, 2018
1
US
Hello all,

I am in dire need of what I assume is a fairly simple powershell script. I have a directory wth many subdirectories. I need to:

Find any directory name converted
Move all files found within the converted directory up one directory
Delete the converted directory
Delete *.cal files from with the same directory that the converted files were moved to

Any help would be greatly appreciated.

Regards,
Chris
 
Chris,

Most of us are willing to assist you with fixing logic/syntax, but I don't know if anyone is going to want to write the script for you. We've all been where you are. But you need to give it a shot, so you can learn how to do it. Then come back with something we can work from/with if you need additional assistance.

Don't get discouraged.

Here's something to help get you started:

Code:
$start_dir = "C:\"
$search_folder = "converted"

## Search for folders 
$folders = Get-ChildItem $start_dir -Recurse | where {$_.PSIsContainer -AND $_.name -eq $search_folder} | Select-Object FullName

## Display search results
$folders


Light travels faster than sound. That's why some people appear bright until you hear them speak.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top