Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to get script to create a new file that lists folder content sorted by size? Post 302986546 by Braveheart on Sunday 27th of November 2016 05:26:44 AM
Old 11-27-2016
How to get script to create a new file that lists folder content sorted by size?

I have a script that sorts and processes unsorted files to newly created directories.

Its working great, but I am trying to understand the leanest method to get the script to create an additional file within each newly created directory that:

Contains a list of all files in the directory sorted by size order.

Code:
#!/bin/bash
read -p "Good Morning, Please enter your file type name for sorting [ENTER]:" all_extensions
if cd /Users/christopherdorman/desktop
  then  while read extension
      do    destination="folder$extension"
        mkdir -p "$destination"
        mv  -v unsorted/*."$extension" "$destination"
      done   <<< "${all_extensions// /$'\n'}"
        mkdir -p foldermisc 
        if mv  -v unsorted/* "foldermisc"
      then  echo "Good News, the rest of Your files have been successfully processed"
        fi
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep content of files sorted by time stamp

egrep Date: *.html > out.htm I would like to grep the match as sorted by time stamp of the html files. how do I do that? (1 Reply)
Discussion started by: zer0
1 Replies

2. Shell Programming and Scripting

Script to Edit the file content and create new file

I have a requirement, which is as follows *. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end. *. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Discussion started by: sudesh.ach
1 Replies

3. Shell Programming and Scripting

Shell Script to Create non-duplicate lists from two lists

File_A contains Strings: a b c d File_B contains Strings: a c z Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below. Resultant... (7 Replies)
Discussion started by: mlv_99
7 Replies

4. Shell Programming and Scripting

Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files. Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies

5. Shell Programming and Scripting

Shell script that lists files with different owner than the folder

Hello, I'm trying to write a script which is listing files based on different preferences, like filetype or permissions. All is fine, except for one: I want to list files in /home which has a different owner than the home directory it is in. Here is an example: /home/UserA is the directory, and... (10 Replies)
Discussion started by: Zwiebi
10 Replies

6. Shell Programming and Scripting

Script to create folder, copy file, and send email on success

I am very new to UNIX as well as scripting so please be gentle, haha. I have a Linux client which has a mount point mapped to my /etc folder on a NetApp FAS system. I woudl like to be able to copy the hosts and rc files once a week from the FAS to a different location for backup. When the... (4 Replies)
Discussion started by: minnino
4 Replies

7. Shell Programming and Scripting

How to create a shell script to read a foldername from a text file and go to the folder?

Hi, I am trying to write a shell script which can read folder names from a text file and then go to the folder and picks up a xml file and write on my sipp script so that I can run the sipp script. For example: I have a text file called thelist.txt where I have provided all the folders... (7 Replies)
Discussion started by: pm1504
7 Replies

8. Shell Programming and Scripting

Create archive and nil the content of log file using script

Plese help I need a urgent requirement. Ex: test.log requirement : using shell script I need to archive the log file and nil and the content of (test.log) file to 0 kb and then in the archive folder log files are name to test.tar test1.tar test2.tar EX: /home/abc/ test.log ... (1 Reply)
Discussion started by: johney1981
1 Replies

9. Shell Programming and Scripting

How to save sorted content of a inside the same file?

Hi All, When i use sort Test, here is the output: $ sort Test a b b c d e f g h i But the contents in the file remain unsorted, how to do that? ]$ cat Test g i (6 Replies)
Discussion started by: chandrakanth
6 Replies

10. UNIX for Beginners Questions & Answers

How to create a summary file of all files in a directory sorted in reverse alphabetical order.?

I have an interactive script which works terrific at processing a folder of unsorted files into new directories. I am wondering how I could modify my script so that( upon execution) it provides an additional labelled summary file on my desktop that lists all of the files in each directory that... (4 Replies)
Discussion started by: Braveheart
4 Replies
GENCFU(1)							 ICU 50.1.2 Manual							 GENCFU(1)

NAME
gencfu - Generates Unicode Confusable data files SYNOPSIS
gencfu [ -h, -?, --help ] [ -V, --version ] [ -c, --copyright ] [ -v, --verbose ] [ -d, --destdir destination ] [ -i, --icudatadir direc- tory ] -r, --rules rule-file -w, --wsrules whole-script-rule-file -o, --out output-file DESCRIPTION
gencfu reads confusable character definitions in the input file, which are plain text files containing confusable character definitions in the input format defined by Unicode UAX39 for the files confusables.txt and confusablesWholeScript.txt. This source (.txt) format is also accepted by ICU spoof detectors. The files must be encoded in utf-8 format, with or without a BOM. Normally the output data file has the .cfu extension. OPTIONS
-h, -?, --help Print help about usage and exit. -V, --version Print the version of gencfu and exit. -c, --copyright Embeds the standard ICU copyright into the output-file. -v, --verbose Display extra informative messages during execution. -d, --destdir destination Set the destination directory of the output-file to destination. -i, --icudatadir directory Look for any necessary ICU data files in directory. For example, the file pnames.icu must be located when ICU's data is not built as a shared library. The default ICU data directory is specified by the environment variable ICU_DATA. Most configurations of ICU do not require this argument. -r, --rules rule-file The source file to read. -w, --wsrules whole-script-rule-file The whole script source file to read. -o, --out output-file The output data file to write. VERSION
1.0 COPYRIGHT
Copyright (C) 2009 International Business Machines Corporation and others ICU MANPAGE
24 May 2009 GENCFU(1)
All times are GMT -4. The time now is 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy