-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Get a list of all PDF files in the current directory | ||
files=(*.pdf) | ||
|
||
# Remove the first character and store the results in a new array | ||
new_files=() | ||
for file in "${files[@]}"; do | ||
new_files+=("${file:1}") | ||
done | ||
|
||
# Remove the ".pdf" extension and store the results in another array | ||
final_files=() | ||
for file in "${new_files[@]}"; do | ||
final_files+=("${file%.pdf}") | ||
done | ||
|
||
# Sort the final list in ascending order | ||
final_files=($(printf "%s\n" "${final_files[@]}" | sort -n)) | ||
|
||
# Print the sorted list to a new text file | ||
printf "%s\n" "${final_files[@]}" > a1_names.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
ss4 | ||
ss4 | ||
w2 | ||
w2w3 | ||
w4 | ||
w7 | ||
w7 | ||
w7sp | ||
w7sp | ||
w9 | ||
w9 | ||
17 | ||
54 | ||
216 | ||
334 | ||
463 | ||
505 | ||
519 | ||
525 | ||
555 | ||
556 | ||
559 | ||
590b | ||
594 | ||
706 | ||
706 | ||
709 | ||
843 | ||
843 | ||
926 | ||
941 | ||
941 | ||
970 | ||
1040es | ||
1040gi | ||
1040s | ||
1040s1 | ||
1040s2 | ||
1040s3 | ||
1040tt | ||
1040x | ||
1040x | ||
1041 | ||
1041 | ||
1065 | ||
1065 | ||
1099ac | ||
1099c | ||
1099r | ||
1116 | ||
1116 | ||
1120 | ||
1120 | ||
1127 | ||
1660 | ||
2555 | ||
2555 | ||
2587 | ||
2848 | ||
2848 | ||
3520 | ||
3520 | ||
4245 | ||
4491 | ||
4491x | ||
4506 | ||
4506t | ||
4868-auto-extension | ||
5471 | ||
5471 | ||
8453 | ||
8606 | ||
8606 | ||
8814 | ||
8814 | ||
8821 | ||
8821 | ||
8865 | ||
8879 | ||
8936 | ||
8938 | ||
8938 | ||
8958 | ||
9465 | ||
9465 | ||
12153 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Generally: | ||
I want a bash script that will organize the files in one directory. | ||
|
||
I have a list of PDF files in one directory. | ||
All files start with "i", "p" or "f". | ||
All files have the extension, ".pdf". | ||
|
||
I would like to use a multi-step approach. | ||
|
||
1. Remove the first character of the filename and save the name to a list. | ||
All the files have the extension ".pdf". | ||
2. Using the list, remove the file extensions, ".pdf" from all the files names, saving the resultant. | ||
3. Next I want the list of abbrevaited-filenames sorted in ascending order. | ||
|
||
For example: (p555.pdf, i456.pdf, f1010-sr.pdf) would become (1010, 456, 555) | ||
|
||
4. Print the list of filenames to a new text document, called a1_names.txt. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.