Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.25 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. unzip dummy.zip #unzips dummy.zip directory
  4. echo "enter three file types" #displays message to user for input
  5. read -r filetype1 filetype2 filetype3  #reads user input
  6. echo "enter your desired URL with the zip file to be downloaded"
  7. read -r userURL  #reads user input for URL
  8.  
  9.  ${1+"$@"} #accepts variable number of command line arguments
  10.  
  11. mkdir dir1 dir2 dir3 dir4 # creates directories called dir1 dir2 dir3 dir4
  12.  
  13. mv ~tony/Desktop/unsorted_files/*.$filetype1 ~tony/Desktop/dir1 #moves all  files of type specified as filetype1 in unsorted_files to dir1
  14. mv ~tony/Desktop/unsorted_files/*.$filetype2 ~tony/Desktop/dir2 #moves all  files of type specified as filetype2 in unsorted_files to dir2
  15. mv ~tony/Desktop/unsorted_files/*.$filetype3 ~tony/Desktop/dir3 #moves all  files of type specified as filetype3 in unsorted_files to dir3
  16.  
  17. mv ~tony/Desktop/unsorted_files/* ~tony/Desktop/dir4 #moves all remaining files in unsorted_files to dir4
  18.  
  19. ls -S ~tony/Desktop/dir1>Dir1SizeList.txt #sorts files in dir in order of size, largest first; outputs content of sorting to Dir1SizeList.txt file
  20. ls -S ~tony/Desktop/dir2>Dir2SizeList.txt #sorts files in dir2 in order of size, largest first; outputs content of sorting to Dir1SizeList.txt file
  21. ls -S ~tony/Desktop/dir3>Dir3SizeList.txt #sorts files in dir3 in order of size, largest first; outputs content of sorting to Dir1SizeList.txt file
  22. ls -S ~tony/Desktop/dir4>Dir4SizeList.txt #sorts files in dir4 in order of size, largest first; outputs content of sorting to Dir1SizeList.txt file
  23.  
  24. mv ~tony/Desktop/Dir1SizeList.txt ~tony/Desktop/dir1 #moves .txt file to dir1
  25. mv ~tony/Desktop/Dir2SizeList.txt ~tony/Desktop/dir2 #moves .txt file to dir2
  26. mv ~tony/Desktop/Dir3SizeList.txt ~tony/Desktop/dir3 #moves .txt file to dir3
  27. mv ~tony/Desktop/Dir4SizeList.txt ~tony/Desktop/dir4 #moves .txt file to dir4
  28.  
  29. ls -r ~tony/Desktop/{dir1,dir2,dir3,dir4} >> AllDirectoriesFileInfo.txt #sorts contents of directories contained within braces in reverse alphabetical order and stored in .txt file
  30. ls -l ~tony/Desktop/{dir1,dir2,dir3,dir4} >> AllDirectoriesFileInfo.txt #provides count of number of files in each directory, stores in .txt file
  31.  
  32. curl -O $userURL #takes command line argument URL, and then downloads the file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement