Find folder name from a specific location - command

How can I find a folder from a specific location using command prompt.
eg:- I want to search files from desktop and there are around 10 files that contains the name starting from A and i want locations of all such file with file name.
I know it can be done using find commnad but I am unable to write the correct code for it.
Thanks for the help

you can find all files from a directory and sub directories that start with 'a' using this:
dir /b /s a*.*

Related

Batch file copy command partial name on file to directory

I have several files in a folder C:/Folder1 and I would like to create a batch file with copy or move command, to copy/move the files containing a partial number,12345, to C:/Folder2. The partial number it not at the beginning or end of the file name but in the middle.
I tried with wildcards but doesn't work.
Copy or Move ***.pdf C:/Folder2
Can anyone help please ?
Thanks,
Rui

Copy files in different subdirectories to another directory using a file list

so I have a list of about 26,000 files that I need Copied/moved to a different directory on a server. The different files in the list all have different sub-directory locations and names in the main source folder and the paths are specified in the filelist document.
The source filepath is on a network drive so (V:\RandomFolder\RandomSubdirectory)
The destination filepath would be on the local machine so (C:\RandomDestination)
I looked into seeing of robocopy could pull from the file list and move that way but I couldn't seem to find a way to make that work. Anyone got any ideas? I'd really appreciate any help.
Okay I figured it out, if anyone runs into this conundrum just follow like what is below( and edit to your liking and save it as a .bat
`#ECHO ON
SET FileList=C:\listoffilestomove.txt
SET Source=\\TopLevelOfNetworkOrFolderSourceDirectory\
SET Destination=C:\yourdestination
FOR /F "USEBACKQ TOKENS=*" %%F IN ("%FileList%") DO XCOPY /F /Y "%Source%\%%~F" "%Destination%\"
GOTO :EOF`

moving files to different folders from 1

I have 200,000 files I want to send to different folders based on key words in the file name
in English if a file name has (shtf or prepper or prepping or survival) in the name send(move) it to folder shtf
if a file has (cookbook or gluten or recipe) move to food folder
*cookbook* *GLUTEN* *RECIPE*
example
(file name)
more shtf tips.epub move to folder shtf
ifshtfbeready.epub move to folder shtf
oldworldcookbook.epub move to folder food
i'm old retired ibmer small basic sas dos commands or ????
Here is a bash command, you may be able to adapt it into dos etc. I'm posting this because others may it useful as well.
find . | grep -E "(cookbook|gluten|recipe)" | while read name; do mv $name directory; done;
Where directory is the name of the directory you want to move the file. You can replace . with whatever starting directory you want, of course.
You can use wildcard in the source filename list and use a directory as the target to move multiple files with one command.
move c:\dir1\*cookbook*.* c:\food
move c:\dir1\*gluten*.* c:\food

7zip / winrar command to extract a folder with path intact to specific folder but excluding parent source path

example
There is a file "sample.rar".
Folder structure is: "rising\dawn\ and here there are many (folders1, folders2 and file1, file2)" in this archive.
i have used following command
7z.exe x "sample.rar" "rising\dawn\*" -oi:\delete
The result is:
all files and folders in "rising\dawn\" are extracted to "i:\delete" folder but the empty parent folders "rising\dawn\" are also created in destination folder.
e.g. destination looks:
i:\delete\rising\dawn\folder1\file1.bmp
i:\delete\rising\dawn\folder2\subfolder
i:\delete\rising\dawn\file1.txt
i:\delete\rising\dawn\file2.txt
i don't want "rising\dawn\" empty folders to be created but the folder structure there onwards must be as is in the archive.
i want the result:
i:\delete\folder1\file1.bmp
i:\delete\folder2\subfolder
i:\delete\file1.txt
i:\delete\file2.txt
at last i found a way out solution. thanks to the winrar support. i have accepted it as an answer below.
if you find the question useful don't forget to click the up-vote button.
Finally this gave me the result.
Thanks to winrar support.
rar x -ep1 sample.rar rising\dawn\* d:\e\delete\
i have tried other answers given here, this is the only correct answer.
don't forget to upvote.
You can extract the archive normally and
1) move the lower level folder/files to where you would like it, then
2) remove the extra top level archive folders.
Code to do so will depend on the exact task.
Using e command instead of x and add -r option works well.
Like this:
7z.exe e -r "sample.rar" "rising\dawn\*" -oi:\delete
My executable version is "7-Zip [64] 9.20 2010-11-18",
And the platform is Windows 8.1.
This command line eliminates unnecessary parent folders and preserves the hierarchy of folders.
You need to use the e command rather than the x command:
7z.exe e "sample.rar" "scholar\update\*" -oi:\delete
Using e instead of x means 7zip will extract all matching files into the same folder (as specified via the -so switch, or the current directory if this isn't specified) rather than preserving the folder structure from inside the archive.

Search Files of a directory in another directory

Things Required Step-By Step:
List all files/items in Directory/Sub-Directory.(e.g. List files/items of DirA)
Search All Listed Files in another Directory (e.g. Search files/items of DirA in DirB)
output the result using windows search. (e.g. each file/item is individually searched in DirB and results displayed in individual search Windows )
Required in a .bat file (Command Line script) or suggest a tool which helps me perform this.
You can check for file and subfolder names from one folder in another folder like this (if that's what you mean by "search all listed files in another directory"):
for %%f in ("C:\folder1\*") do (
if exist "C:\folder2\%%~nxf" echo %%~nxf exists in C:\folder2
)
It's not clear to me what you mean by "output the result using Windows Search", though.