Separate folders and files with Upper case & Lower case filenames from Windows - windows-10

I have folders of files with uppercase and lowercase filenames in Windows system.
For filenames starting with "a" or "A" are stored in either folder "A", or "a". All filenames starting with "b" or "B" are stored in either folder "B", or "b". etc
Currently folder names may be either uppercase "A" or lowercase "a" randomly.
Now, my task is to sort these folders and files as if they are "case-sensitive" and separate the files into different folders according to uppercase and lowercase directory names & filenames. (e.g. atF0Gxx file put under "a" folder, while A0p9xxx file put under "A" folder, and similarly for b, B, c, C, d, D... z, Z)
Can i do so in Windows 10? Can do so programmatically?
My Windows 10 file system is currently using default, so case-insensitive.
I need to sort these folders and files for import into Linux system later.
Files with a mix of uppercase and lowercase filenames

Related

Need to move files to specific directory based on last two characters of filename in Linux

Please forgive my ignorance. I'm sure this is very basic, but I am so new to Bash. Any help you can provide is greatly appreciated.
I have a series of files (within a source directory) that I need to organize into other specific directories based on the last two charcters of their name. e.g. K1F2P4T1, needs to go to one directory while K1F2P4R1 needs to go to another. What I need it to do is check all files for the last two characters and if it ends with, e.g T1, E1, or B1 it goes to one directory and if it ends in C1, M1, or Z1 it gets moved to another.
How can I do this?
You can use
mv *{T1,E1,B1} one_dir
mv *{C1,M1,Z1} another_dir

Copy numbered image files where number is less than X

I have a folder of 10,000 JPEg's labeled 1.JPG to 10000.JPG. I want to copy all files that have a number less than (or greater than) X to another directory. What's the best way to do this from the command line?
A simple brace expression would zap this, here I am guessing at your number range of course:
cp {25..400}.jpg another_dir
More information on brace expressions here: http://www.linuxjournal.com/content/bash-brace-expansion which includes:
The syntax for brace expansion consists of either a sequence
specification or a comma separated list of items inside curly braces
"{}". A sequence consists of a starting and ending item separated by
two periods "..".

Simultaneously renaming multiple files with different names

I have around 150 files with the same .txt extension, but the filenames are just alphanumeric strings (e.g. 7J9E45600.txt, FF5632088.txt, etc.). I have a list where the alphanumeric strings are matched to more meaningful names. I want to replace these alphanumeric strings with the meaningful names, but would like to do it programatically. Most of the existing solutions allow to rename multiple files with incrementally increasing numbers, e.g. via a loop command, but in my case all the filenames will be different. An example of what I want to do is as follows: rename 7J9E45600.txt to adipose.txt, rename FF5632088.txt to brain.txt, etc. A solution utilizing Linux, R, Perl or Python is most welcome.
Yes, this is easy to do with a for loop in R.
Make or read in your data, with a column of old names, and a matching column containing the new names. I copied an example with four files.
oldnames<-c("/Users/foo/Documents/pictures/Test/2020-04-21 19.59.jpg",
"/Users/foo/Documents/pictures/Test/2020-04-21 19.59.35.jpg",
"/Users/foo/Documents/pictures/Test/2020-04-21 19.58.37.jpg",
"/Users/foo/Documents/pictures/Test/2020-04-21 17.21.06.jpg")
newnames<-c("/Users/foo/Documents/pictures/Test/2021-04-21 19.59.59.jpg",
"/Users/foo/Documents/pictures/Test/2021-04-21 19.59.35.jpg",
"/Users/foo/Documents/pictures/Test/2021-04-21 19.58.37.jpg",
"/Users/foo/Documents/pictures/Test/2021-04-21 17.21.06.jpg")
testnames_df<-data.frame(cbind(oldnames,newnames))
for (i in 1:4) {file.rename(from=testnames_df$oldnames[i], to = testnames_df$newnames[i])}

data mining algorithm that suggest for this situation

This is not a directly programming related question, but it's about selecting the right data mining algorithm.
i have some folders suppose 100 folders , contents of these folders are images and text documents , i have excel tables ( 100 tables ) for these folders which mean for each folder there are particular table , this excel table content as follow :
in header ( columns header ) include the content of this folder and rows include the files i would be check ( my test files ) the values in this table are o's and 1's if the file is found in that folder then value 1 otherwise o , these test files names are same for all folders ,
Q: what are the best data mining algorithm can work on excel file tables , and can cluster these folders based on test file content for example cluster 1 include folders which contain the files 1 and file 20 and file 25 .. and so on .. consider i use matlab language ?
thanks ...
The english here is a little confusing so I'll interpret the question best as I can. What you want to do here doesn't seem to require any complicated algorithm. Go ahead take your excel data and export it as CSV so that you can work in Matlab.
Right now you have data as follows:
Folder -> [ Files ]
You probably want to build an index this way:
File -> [ Folders ]
This way, you when you ask the question: "What folders contain files 1, 20 and 25", you can look up (in constant time) 3 things:
Folders that contain file 1
Folders that contain file 20
Folders that contain file 25
And then take the intersection of those sets.
===================================================
The other thing you might be interested in doing is "clustering". For that, go ahead and take your Folder descriptors (the ones and zeroes) and treat that as a feature/vector. Then go ahead and run any clustering algorithm on it. K-means clustering is an easy one to implement in Matlab.
[1] https://en.wikipedia.org/wiki/Cluster_analysis

vim: FuzzyFinder and the numbers of the list of the matching file names

I'm using FuzzyFinder, when I start to write the name of a file to open it, a list of files that match the letters are shown. On the left of each of those files there is a number.
What do those number mean? Is there maybe any way to open a file from the list using that number?
Or what way do you use for selecting the files from the list apart from using the cursor keys?
Javi
Those numbers can be used if you append it after a ; - so if you type ab and end up with a list with 10 files, you can select the 5th with ab;5.
You could also select a file from the list without entering a pattern at all, starting directly with ; and following with a number in the list. More info at :h fuf-search-patterns.
I use Ctrl-p/Ctrl-n to select the match, similar to cursor keys, when the desired file is at most three or four positions from the top.

Resources