Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report