Answer the question
In order to leave comments, you need to log in
How to find files by owner and time after they were created?
I'll go straight to the point.
OS: Windows
Task:
Given a directory hierarchy. We are given the absolute address of one of the directories. It is necessary to find in this directory all files by def. template belonging to def. user, and time after creation, which are more than 2 days. Implement either as a bat script or as a command pipeline.
Trying to solve:
1. Pattern search was done with where /r abs the path we were given [pattern]. This way I got the absolute addresses of all files that match my pattern.
2. Search for the owner thought to do either through dir / q | find "username" or via cacls "path to file" | find
"username". The first option is not very good, since the file path entry may contain the username substring,
3.Time after creation. It seems to be solved by parsing the result of the dir command and then dancing with a tambourine
4. Ultimately, in order to copy, I need to know the absolute path and file name.
The main problem is in points 2 and 3.
Does anyone have any ideas how to deal with this?
Answer the question
In order to leave comments, you need to log in
Decided points 1,2,4.
forfiles /p [Путь где ищем] /d -[кол-во дней] /m [маска] /s /c "cmd /c copy @path [Путь куда вставляем]@file"
forfiles /p homework /d -2 /m *.txt /s /c "cmd /c copy @path D:\good\@file"
forfiles /p [Путь поиска] /d -[кол-во дней] /m [маска] /s /c "cmd /c dir /q @path | find \"%computername%\%username%\" && copy @path [Путь для вставки]@file"
forfiles /p homework /d -2 /m *.txt /s /c "cmd /c dir /q @path | find \"%computername%\%username%\" && copy @path D:\good\@file"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question