Skip to content

Instantly share code, notes, and snippets.

View P-Bauer's full-sized avatar

Pedro Bauer P-Bauer

View GitHub Profile
@P-Bauer
P-Bauer / gist:48327929a3a312cdf883016c11b4b34d
Created July 27, 2023 08:47
Powershell command to replace all spaces of files in a directory with underscore
ls *.* | Rename-Item -NewName { $_.name -replace " ","_" }
@P-Bauer
P-Bauer / replace_space.ts
Created July 26, 2023 21:01
Replaces file spaces with underscores
import * as fs from 'fs';
const directoryPath = '/path/to/directory';
fs.readdir(directoryPath, (err, files) => {
if (err) {
console.error('Error reading directory:', err);
} else {
files.forEach(file => {
if (file.includes(' ')) {