benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 66999b2c-b620-5aa6-ac6c-5ccdc43e06a3

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import os
import shutil
import glob

def task_func(source_dir, dest_dir, extension):
    """
    Move all files with a particular extension from one directory to another.
    
    Parameters:
    - source_dir (str): The source directory.
    - dest_dir (str): The destination directory.
    - extension (str): The file extension.

    Returns:
    - result (int): The count of files that were moved. 

    Requirements:
    - os
    - shutil
    - glob
        
    Example:
    >>> task_func('path_to_source_dir', 'path_to_dest_dir', '.txt')
    10
    """

instruct prompt

Move all files with a particular extension from one directory to another.
The function should output with:
    result (int): The count of files that were moved.
You should write self-contained code starting with:

Code

import os
import shutil
import glob
def task_func(source_dir, dest_dir, extension):

code prompt

Code

import os
import shutil
import glob
def task_func(source_dir, dest_dir, extension):

entry point

task_func

libs

  • glob
  • shutil
  • os

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import