first commit
This commit is contained in:
BIN
c-scripts/a.out
Executable file
BIN
c-scripts/a.out
Executable file
Binary file not shown.
36
c-scripts/image_list.txt
Executable file
36
c-scripts/image_list.txt
Executable file
@@ -0,0 +1,36 @@
|
||||
2025-05-01-181919_hyprshot.png
|
||||
7731792.jpg
|
||||
wallhaven-5ydwp7.jpg
|
||||
wallhaven-2yp7kx.jpg
|
||||
wallhaven-ly93ry.png
|
||||
hm2.jpg
|
||||
wallhaven-vpx9d8.jpg
|
||||
2025-05-01-181934_hyprshot.png
|
||||
wallhaven-3qo72y.jpg
|
||||
wallhaven-w58xxr.jpg
|
||||
wallhaven-d8xrxj.png
|
||||
wallhaven-p2zoqp.jpg
|
||||
wallhaven-oxolyp.png
|
||||
tetris.png
|
||||
wallhaven-2k1wlg.jpg
|
||||
wallhaven-9ox888.png
|
||||
wallhaven-zpg2jo.jpg
|
||||
wallhaven-5g2gp1.png
|
||||
2025-05-01-181246_hyprshot.png
|
||||
2025-05-01-180922_hyprshot.png
|
||||
2025-05-17-122055_hyprshot.png
|
||||
wallhaven-9oxg98.jpg
|
||||
2025-05-28-112241_hyprshot.png
|
||||
wallhaven-3qkggv.jpg
|
||||
wallhaven-w5ojd6.jpg
|
||||
w2.jpg
|
||||
wallhaven-6ozg3x.jpg
|
||||
KOHAKUNUSHI_katana_pistol_teeth_Nord_Theme_gun_anime_anime_girls-2228190-1141462850.png
|
||||
wallhaven-p9zjrj.png
|
||||
w8.jpg
|
||||
arch-rainbow-1920x1080.png
|
||||
5748270.png
|
||||
wallhaven-e8o9zk.jpg
|
||||
2025-06-26-153933_hyprshot.png
|
||||
2025-05-01-182047_.png
|
||||
wallhaven-9o5xr1.jpg
|
||||
44
c-scripts/list_images.c
Executable file
44
c-scripts/list_images.c
Executable file
@@ -0,0 +1,44 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
int main() {
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
char filepath[1024];
|
||||
FILE *fp;
|
||||
|
||||
// Open the directory
|
||||
dir = opendir("/home/arthur/Pictures");
|
||||
if (dir == NULL) {
|
||||
perror("opendir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create a new text file to save the list of images
|
||||
fp = fopen("image_list.txt", "w");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
// Check if the entry is a file and ends with ".jpg" or ".jpeg"
|
||||
if (entry->d_type == DT_REG && strstr(entry->d_name, ".jpg") != NULL) {
|
||||
printf("Found image: %s\n", entry->d_name);
|
||||
fprintf(fp, "%s\n", entry->d_name);
|
||||
}
|
||||
if (entry->d_type == DT_REG && strstr(entry->d_name, ".png") != NULL) {
|
||||
printf("Found image: %s\n", entry->d_name);
|
||||
fprintf(fp, "%s\n", entry->d_name);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the directory and text file
|
||||
closedir(dir);
|
||||
fclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user