Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the file sorting and finishing machine by batch processing

Shulou Source: shulou.com Published: 2022-06-03 07:08:58 10月19日 Update

This article is to share with you about how batch processing implements the file categorizer. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The code is as follows:

@ echo off

Title file categorizer

: objective:

::

Classify different files under the current directory (do not deal with subdirectories)

::

:: 2006-12-16 fixed an error

For / f "delims="% I in ('dir / amurd / b / oe') do (

Set "nx_name=%%~nxi"

Call: build_dir% ~ xi

Set file_type=%%~xi

)

Goto: eof

Rem = create folders by file type =

: build_dir

Set types=%1

Set types=%types:~1%

:: determine whether the file to be processed is the batch itself

If "% nx_name%" = = "% ~ nx0" (set file_self=yes&set file_type=) else set file_self=

:: determine whether the 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

Thank you for reading! This is the end of this article on "how to realize the file categorizer in batch processing". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it out for more people to see!

Tags: Files categorization content more articles types processing different good practical code subdirectories folders articles directories purposes see knowledge errors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Microsoft OPPO Reno Shulou Tech Info Redmi