Find Jobs
Hire Freelancers

Create / troubleshoot a batch file that moves folders based on criteria

$30-250 USD

完了済み
投稿日: 7年以上前

$30-250 USD

完了時にお支払い
I need a batch file to assess subfolders and if they meet certain criteria then they get moved to a new folder. I have tried to do it myself but have not been successful. Below I have an outline of my work so far. Folder structure is something like this Main folder is: I:\Test\divideandconquer\Newfolder\ In that folder there can be an number of different subfolders. eg I:\Test\divideandconquer\Newfolder\106-foldername What I want is a batch that compares the first 3 numbers of the folder name (in this case 106) with the number of files in that folder. If the two numbers match then the criteria is met and the folder should be moved to: I:\Test\divideandconquer\moved\ I have a working batch that can compare the two numbers and return a value. @echo off setlocal disableDelayedExpansion pushd I:\Test\divideandconquer\Newfolder set "files=" for /r %%F in (*) do call set files=%%files%% %%F echo %files% set files=%files:~36,3% echo %files% pushd I:\Test\divideandconquer\Newfolder\*1* set actual=100 for %%x in (*) do set /a actual+=1 echo %actual% IF %actual% EQU %files% echo same | clip I also have found a batch that can move folders based on criteria being met (found it on stackoverflow). for /d %%A in (*) do ( dir /b %%A\*.txt >nul 2>&1 && move %%A "folders with txt" ) But of course the criteria are not right. To make it work I think I need to change dir /b %%A\*.txt >nul 2>&1 to check my IF %actual% EQU %files% result but I dont know how to combine the two codes. ===================== UPDATE I tried a few things including... @echo off setlocal disableDelayedExpansion pushd I:\Test\divideandconquer\Newfolder set "files=" for /r %%F in (*) do call set files=%%files%% %%F echo %files% set files=%files:~36,3% echo %files% pushd I:\Test\divideandconquer\Newfolder\*1* set actual=100 for %%x in (*) do set /a actual+=1 echo %actual% IF %actual% EQU %files% THEN ( set result=1 ) for /d %%a in (*) do ( set /a oktomove=result - %%a if !oktomove! EQU 1 move /Y %%a I:\Test\divideandconquer\moved\ )
プロジェクト ID: 11959356

プロジェクトについて

2個の提案
リモートプロジェクト
アクティブ 7年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
アワード者:
ユーザーアバター
Yes, some things are not so easy to do in pure batch scripting. However, I can do it, so I'll be glad to make this for you. Update: I've already made it, so it's waiting you. :-)
$30 USD 1日以内
5.0 (2 レビュー)
1.6
1.6
この仕事に2人のフリーランサーが、平均$30 USDで入札しています
ユーザーアバター
Hello, I have lost your message.. can you message me. Thanks, Sheik
$30 USD 2日以内
5.0 (4 レビュー)
3.4
3.4

クライアントについて

UNITED KINGDOMのフラグ
Farnborough, United Kingdom
5.0
16
お支払い方法確認済み
メンバー登録日:6月 29, 2015

クライアント確認

ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。