Question

Write a cmd script for finding folders including subfolder names and sizes. Do not include file...

Write a cmd script for finding folders including subfolder names and sizes. Do not include file name and size

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CMD SCRIPT FOR FINDING FOLDERS INCLUDING SUBFOLDERS

@echo off

    setlocal disabledelayedexpansion

    set "folder=%~1"

    if not defined folder set "folder=%cd%"

    for /d %%a in ("%folder%\*") do (

        set "size=0"

        for /f "tokens=3,5" %%b in ('dir /-c /a /w /s "%%~fa\*" 2^>nul ^| findstr /b /c:" "') do if "%%~c"=="" set "size=%%~b"

        setlocal enabledelayedexpansion

        echo(%%~nxa # !size!

        endlocal

    )

    endlocal

Add a comment
Know the answer?
Add Answer to:
Write a cmd script for finding folders including subfolder names and sizes. Do not include file...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Open IDLE. Create a new script file (File-->New File, Ctrl+n on Windows, Cmd+n on macOS). On...

    Open IDLE. Create a new script file (File-->New File, Ctrl+n on Windows, Cmd+n on macOS). On the first line, place your name in a comment. Create a program that does the following: Write a simple guessing game The game will generate a random number between 1 and 10 The first line, after your name, must be import random Each time the user types a number, inform them if their guess is too high or too low Keep prompting them until...

  • Write an awk script to print just the name and size of ordinary files (do not...

    Write an awk script to print just the name and size of ordinary files (do not include directories), one on each line. The output must be aligned as shown in the example below. First, analyze a typical output of the ls -l command to see what differentiates an ordinary file from a directory and which fields contain the file name and size information. Then, determine what the field separator is and whether the default field separator of awk will work,...

  • PYTHON 3.6.1 write a script named copyfile.py. this script should prompt the user for the names...

    PYTHON 3.6.1 write a script named copyfile.py. this script should prompt the user for the names of two text files. the contents of the first file should be input and written to the second file.

  • Create a VBScript script (w3_firstname_lastname.vbs) that takes one parameter (folder name) to do the following 1)...

    Create a VBScript script (w3_firstname_lastname.vbs) that takes one parameter (folder name) to do the following 1) List all files names, size, date created in the given folder 2) Parameter = Root Folder name - The script should check and validate the folder name 3) Optionally, you can save the list into a file “Results.txt” using the redirection operator or by creating the file in the script. 4) Make sure to include comment block (flowerbox) in your code. 5) Sample run:-...

  • Write a script named listEmptyDir.sh that will do the following: (a) take a name of a...

    Write a script named listEmptyDir.sh that will do the following: (a) take a name of a directory as a parameter; (b) loop through all files in this directory and display their names; (c) if a file is a directory and has no files in it (empty directory), add the name of this empty directory to the file EmptyDir.txt in your current directory. If the number of parameters is not 1 or a parameter is not a directory, display the “usage”...

  • Shell script Write a case condition that: Store the file name by default in $FILE or...

    Shell script Write a case condition that: Store the file name by default in $FILE or you may read it as input argument while running the script. Case 1- checks if file is a directory Case 3- file is a regular file Case 2- if a file is readable Case 3- if file is writeable Problem 5: Write a shell script that reads a filename; and verifies the file extension to be text/ jpeg/gif/png. If it is text file also...

  • Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a...

    Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a source program. This script should: Prompt the user for the names of two files. The input filename could be the name of the script itself, but be careful to use a different output filename! The script copies the lines of text from the input file to the output file, numbering each line as it goes. The line numbers should be right-justified in 4 columns,...

  • Write a C shell script called canrun that displays the names of the files in the...

    Write a C shell script called canrun that displays the names of the files in the current directory that have execute permission set (permission being for the file owner) and how many of these files there are. For example, output from the script might look like: Executable files: canrun menunix showperm 3 files found

  • For Python | Instructions Write a script named difpy. This script should prompt the user for...

    For Python | Instructions Write a script named difpy. This script should prompt the user for the names of two text files and compare the contents of the two files to see if they are the same. 1. If they are the script should simply output "Yes". 2. If they are not the script should output "No", followed by the first lines of each file that differ from each other The input loop should read and compare lines from each...

  • How do I write a bash shell script that encrypts a file by changing every letter...

    How do I write a bash shell script that encrypts a file by changing every letter except z to the next character in the alphabet. So a becomes b, b becomes c, and so on? z will be changed to a. Also, how do I write a bash shell script that reverses that?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT