/* tolower.c - Cambia el nombre de los archivos a minusculas Copyright(C) 2002, Luis C. Castro Skertchly This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Iniciado en 17-Dic-2002 Versiones corriendo: 1.1 26-Dic-2002 Uso: tolower files */ #include #include #include WIN32_FIND_DATA findData; HANDLE hFind; char newName[MAX_PATH]; char *p, *q; short int i; int main(int argc, char **argv) { if (argc < 2 || argc > 3) { fprintf(stderr, "Usage:\ntolower [-u] filespec\n" " -u Converts to uppercase instead of lowercase\n\n"); return 1; } i = 1; if (!strcmp(argv[i], "-u")) i++; hFind = FindFirstFile(argv[i], &findData); if (hFind == INVALID_HANDLE_VALUE) { printf("No matching files.\n"); exit(1); } do { for (p = findData.cFileName, q = newName; *p; p++, q++) *q = i > 1 ? toupper(*p): tolower(*p); *q = 0; //printf("%s --> %s\n", findData.cFileName, newName); MoveFile(findData.cFileName, newName); } while(FindNextFile(hFind, &findData)); return 0; }