Tuesday, April 3, 2018

How to Create folders or Directories and Copy files in it

How to Create folders or Directories and Copy files in it through CMD

There is a process of creating directories or folders and copy files on that directories or folders.

SKOTechLearn will Describe the Tips to creating directories or folders and copy related files on it.

Everyone who’s involves in image processing or file processing, have the problem of creating directories as according to given Excel Sheet at a time. If we talk about 3 or 4 folder for creation, then it is easy to create manually. But if we talk about more than 10 folders to create at the same time or less time without manual process.
Then we have to consider about Command Line Argument. And if there is also a list of folder and its related files to paste on it. Then we have to face problem to manual process. But the command line argument (CMD) will solve all these problem without time taken.

Easily rename multiple Files through CMD

Suppose, we have an Excel file with name "Data_Details. xlsx". And it containing two column header with name "Folder_Name" containing a list of folder’s name and "Files_Details" containing a list of file’s name. Suppose you want to create folder 00000A, 00000B, 00000C and paste files related with it.

Suppose, you want to create folder with "Folder_Name" and want to copy files as mention in "Files_Details" related to its folders.
Path and sheet to create folder
Source Files Path and Data Details Sheet
Suppose, you have a folder with name "Files" containing files and also created an output folder with name "Output_Folder" and want to create folders inside this output folder and copy files inside it.
Output Folder for create folders
Create Output Folder
Now, type formula in column C as described in following instruction.
A B C
Folder_Name Files_Details
00000A 000001.jpg =CONCATENATE ("MKDIR",A2)
=CONCATENATE : Merge cells formula.
MKDIR : Batch script to create folder.

Here, CONCATENATE is a function to merge cells with external query.
Write formula in column C as [=CONCATENATE(A2, "\", B2)]. This will show the output in column C as "00000A\000001.jpg".

batch script to created folders
MKDIR Script and Source Path Description
After applying this formula in column C, press "Enter" key from keyboard. This will change cells value like: MKDIR 00000A. After that drag and drop this cell to the end of the row. After dragging, it will apply in all rows in column C.

Easily use Google input tool's language in VB6.0 through Code

After that, paste source file’s path in column D where all files are exist and define its column header name as "Source_Path". Set " (double Inverted Comma) in column E and drag it to the end of the row.

This is necessary, because if you contain a folder name with space like: 'Folder Name', batch process can not consider it as folder. So for it, you have to assign double inverted comma in the end and front of path. Drag column E to the end of the row as shown in above image.

Now, the next step to apply formula for copy and paste files with its related folder. So, once again we have to apply "=CONCATENATE()" formula in column F. The following Instruction will help to understand.
A B C D E F
Folder_Name Files_Details Source_Path
00000A 000001.jpg MKDIR 00000A D:\SKOTechlearn… " =CONCATENATE("Copy ",E2,D2,"\",B2,E2," ",C2,"\",B2)

Formula and save notepad for create folder
CONCATENATE formula with COPY Script and Save Notepad
You can set cells in "CONCATENATE" formula directly by selecting cells or you can press on function Fx button as shown in above image.

Easy solution of SendKeys() error in VB6.0

When Pressign on function Fx button, a "Function Arguments" window will appear, add cells with CMD batch script.
Text1 "Copy " = "Copy "
Text2 E2 = """
Text3 D2 ="D:\SKOTechlearn..."
Text4 "\" = "\"
Text5 B2 = "000001.jpg"
Text6 E2 = """
Text7 " " =" "
Text8 C2 ="MKDIR 00000A"
Text9 "\" = "\"
Text10 B2 = "000001.jpg"

The above instruction present the "Function Arguments" window preview. Like this you have to fill every Text (like:- Text1, Text2, Text3 etc).

After that click on "OK" button from "Function Arguments" window, this will show in CONCATENATE value in column F2. Drag and drop this column to the end of the row.

Now, the next step to open a Notepad. First, copy of that column which contain creating folder script.
Like: Column C (MKDIR 00000A, MKDIR 00000B etc). And paste it on Notepad.
Then come to that column which contain copy files script.
Like: Column F (Copy "D:\SKOTechlearn_Images\000001.jpg). And paste it on Notepad.

Save this Notepad with extension name ".Bat" (like:- "BatchFolder_Files.Bat"). Save this file in "Output_Folder" location.

After saving Notepad, go to file location and find "BatchFolder_Files.bat" file and double click on it. this batch file will execute and start creating folders and copying related files on it. After that, your folder creation and copying files will be done successfully like bellow.
Output Details of create folder
Output Details
When you run "BatchFolder_Files.bat" file. It will create folder and copying its related files in it as shown in above image.

Through CMD easily Create folders or Directories and copy files in it.

ASP.Net- Design Header, Footer, Sidebar, Content Layout in WebPage

0 comments: