Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell: Get character string from file name and create directory from string, then move files

$
0
0

Dear All,

i am new on programming. I am making one script by using powershell.

I have many computer log files in a folder, the following are some sample files in the folder

server_authlog_computername1_20130602.log

server_authlog_computername11_20130603.log

server_authlog_computername2_20130601.log

server_authlog_computername1_20130530.log

Remarks:-

All the log files have the same string from the front and have two underscore before the computername(and computername string length of each log file is not the same)

I will need the script to get the characters string(computername) from the filename and create directory from string, and move the right computername files to the same computername folder.

Could anyone advise or suggest me on this?

Thanks and Regards,

Edward


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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