MCPcopy Index your code
hub / github.com/github/docs / findFilesInFolder

Function findFilesInFolder

script/move-content.js:218–232  ·  view source on GitHub ↗
(oldPath, newPath, opts)

Source from the content-addressed store, hash-verified

216}
217
218function findFilesInFolder(oldPath, newPath, opts) {
219 const { undo, verbose } = opts
220 const files = []
221 const allFiles = walk(oldPath, { includeBasePath: true, directories: false })
222 for (const filePath of allFiles) {
223 const newFilePath = filePath.replace(oldPath, newPath)
224 const oldHref = makeHref(CONTENT_ROOT, undo ? newFilePath : filePath)
225 const newHref = makeHref(CONTENT_ROOT, undo ? filePath : newFilePath)
226 files.push([filePath, newFilePath, oldHref, newHref])
227 }
228 if (verbose) {
229 console.log(chalk.yellow(`Found ${files.length} files within ${oldPath}`))
230 }
231 return files
232}
233
234function makeHref(root, filePath) {
235 const nameSplit = path.relative(root, filePath).split(path.sep)

Callers 1

mainFunction · 0.85

Calls 1

makeHrefFunction · 0.85

Tested by

no test coverage detected