I have been looking for the way to do this using get-children
and rename
combined with if
but no luck.
I want to search all subdirectories (subdir1, subdir2, etc) of a directory (test) for a file "trigger.txt"
and if the file exists in one of these subdirectories I want to change the name of another file in the same subdirectory (changeme.txt
to _changeme.txt
)
Rephrasing:
If file subdir1\"trigger.txt"
exists change subdir1\"changename.txt"
to subdir1\"_changename.txt"
I have found scripts to change the name of file if it exists and to look for a file but I cannot connect it together... Any help?