Luis Diaz
asked on
Powershell & windows batch: list who create a file
Hello experts,
I have multiple CSV files in a folder.
I am looking for a powershell or a Windows batch to list in a result.csv the file name in column a and the author (who create the file) of the file in column a.
Thank you in advance.
I have multiple CSV files in a folder.
I am looking for a powershell or a Windows batch to list in a result.csv the file name in column a and the author (who create the file) of the file in column a.
Thank you in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Bill, the problem of the owner is that csv files cames from zip files so if I unzip and transfer them I will appear as the owner.
I need to know the creator.
I tested your proposal but I got an owner.txt blank.
Here is my version:
I need to know the creator.
I tested your proposal but I got an owner.txt blank.
Here is my version:
setlocal EnableDelayedExpansion
set BaseDir=%Cd%
set OutFile=%BaseDir%"\owner.txt
(
for /f "tokens=*" %%A in ('dir /q "%BaseDir%\*.csv" ^| findstr /b /r /c:"[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]"') do (
set Line=%%~A
echo.!Line:~62!,!Line:~39,23!
)
)>"%OutFile%"
pause
ASKER
For powershell approach possible to adjust variables to have get-location folder instead of reported folder?
Thank you.
Thank you.
ASKER
Same result with powershell approach I got the author and not the person who create initiate the file.
Zip archives do not save extended properties as far as i know. Are you able to see original creator via Windows Explorer?
ASKER
Csv files to check are in a zip file when I unzip I checked properties and it is mentioned that the author is me.
Yes, that is because you were the one that extracted the files to the Windows directory, at which time it assigned you as the owner in the directory owner info.
But that information is not stored in a ZIP file when files are added to the ZIP, so there is no way to preserver the original owner of the files that went into the ZIP when you unzip them.
»bp
But that information is not stored in a ZIP file when files are added to the ZIP, so there is no way to preserver the original owner of the files that went into the ZIP when you unzip them.
»bp
Exactly. Zip archives do not save extended properties.
ASKER
Noted. Thank you very much for your help.
Open in new window