Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Renaming a text file using powershell

$
0
0

Hi everyone. I have a database that does 2 exports every night to a c:\spool directory. There are many other files in that directory that I do not need. Every night instead of overwriting the 2 export files, the software creates a new filename. It started asc:\spool\krwfcemg0001.txt, and has incremented each night and is now c:\spool\krwfcemg0047.txt. I tried deleting the files to see if the naming would start over, it didn't.

I need a name that doesn't change so that I can copy that file over ever night to a server for an automatic import. Can anyone help me. I've tried the following but none have worked.

Rename-Item C:\spool\krwfcemg*.txt

Rename-Item C:\spool\krwfcemg****.txt krwfcemg0001.txt

Rename-Item C:\spool\krwfcemg????.txt krwfcemg0001.txt

Rename-Item C:\spool\krwfcemg[0001-9999].txt krwfcemg0001.txt


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>