Batch file collation (face-to-face directory) _dos/bat

Source: Internet
Author: User
Tags goto
Copy Code code as follows:

@echo off
Title File Collation Manager

:: Objective:
::
:: Categorize the different files in the current directory (do not process subdirectories)
::
:: 2006-12-16 modified a mistake

for/f "delims="%%i in (' dir/a-d/b/oe ') do (
Set "Nx_name=%%~nxi"
Call:build_dir%%~xi
Set File_type=%%~xi

)
Goto:eof

REM ======= Create a folder by file type =======
: Build_dir
Set types=%1
Set types=%types:~1%

:: Determine if the file to be processed is a batch process itself
If "%nx_name%" = = "%~nx0" (set File_self=yes&set file_type=) Else set file_self=

:: Determine if a file type has changed
If "%file_type%" = = "%1" (set Same_type=yes) Else set same_type=

If not defined file_self if not defined same_type MD%types% file 2>nul
If not defined file_self move/-y "%nx_name%"%types% file
Goto:eof

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.