I have 260 files in the directory. The annotation of files is as Imxxx_y, where x is from 001 to 130 and y is 0 or 1. That is, for y=0, I have 130 files and the remaining 130 are for y=1. If I want to copy the first 100 files how can I do that in R? I tried the code as bellow,
fnames <- list.files(path = original_dataset_dir, pattern = "1.tif")
file.copy(file.path(original_dataset_dir, fnames),
file.path(train1_yes_dir))
It copies 130 files, But I want to copy just 100.
You could always just try system("cp this_dir/lm*_1.tif destination_dir/")
. This would work in a bash terminal. If you're in windows you'll have to use the equivalent command there.